/*
* Mq_Server.h
* Last edited: 27.08.2014
* Author: David Noack
*/

#ifndef UDS_SERVER_H_
#define UDS_SERVER_H_

#define MQ_LOG "Log_MQ"

#include "Com_Interface.h"
#include "MyThreadClass.h"
#include <mqueue.h>


/** 
\class MQ_Server
\brief Implements a message-queue-server for prngd.
*/
class MQ_Server : public Com_Interface, MyThreadClass{


	public:
		/**Constructor*/
		MQ_Server(Prngd_State state);
		/**Destructor*/
		~MQ_Server(){};


	private:


		/** Messagequeue of the server.*/
		mqd_t msgqueue;
		/** Messagequeue for the client.*/
		mqd_t mqc;
		/** Struct for the configuration of a messagequeue.*/
		struct mq_attr attr;
		/** Var for reading/writing a message from or to a qeueu.*/
		char msg;
		/** Size of a message*/
		int msgSize;

		/** See doc for My_ThreadClass.*/
		virtual void thread_listen(pthread_t parent_th);
		/** See doc for My_ThreadClass.*/
		virtual void thread_work();

};


#endif /* UDS_SERVER_H_ */

